home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / tnefapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  10.6 KB  |  318 lines

  1. /*
  2.  *  TNEF.H
  3.  *
  4.  *  This declares the published interface to TNEFUTIL.DLL, a set of
  5.  *  utility fuctions designed to encode/decode unusual mail properties in
  6.  *  a Transport-Neutral form.
  7.  *
  8.  *  Owner: Dave Whitney
  9.  *
  10.  *  Copyright 1986-1998 Microsoft Corporation, All Rights Reserved
  11.  */
  12.  
  13. #ifndef     _TNEFAPI_H_
  14. #define     _TNEFAPI_H_
  15.  
  16. #ifdef      __cplusplus
  17. extern "C" {
  18. #endif      /* __cplusplus */
  19.  
  20. /**************************************************/
  21. /* Constants **************************************/
  22. /**************************************************/
  23.  
  24. /*
  25.  *  Type INETENCODE - describes the encoding type for MIME encodings
  26.  */
  27. typedef enum {
  28.     CODE_NONE = 0,
  29.     CODE_UU,                                /* UUEncode                         */
  30.     CODE_B64,                               /* base64                           */
  31.     CODE_QP,                                /* quoted-printable                 */
  32.     CODE_QPH,                               /* quoted-printable, in msg hdr     */
  33. } INETENCODE;
  34.  
  35.  
  36. /*
  37.  *  Codepages supported by TnefConverToUnicode
  38.  */
  39. #define CPG_WINDOWS_1250        1250
  40. #define CPG_WINDOWS_1251        1251
  41. #define CPG_WINDOWS_1252        1252
  42. #define CPG_WINDOWS_1253        1253
  43. #define CPG_WINDOWS_1254        1254
  44. #define CPG_WINDOWS_1255        1255
  45. #define CPG_WINDOWS_1256        1256
  46. #define CPG_WINDOWS_1257        1257
  47. #define CPG_WINDOWS_1258        1258
  48. #define CPG_KOI8_R              20866
  49. #define CPG_KOI8_U              21866
  50. #define CPG_ISO8859_1           28591
  51. #define CPG_ISO8859_2           28592
  52. #define CPG_ISO8859_3           28593
  53. #define CPG_ISO8859_4           28594
  54. #define CPG_ISO8859_5           28595
  55. #define CPG_ISO8859_6           28596
  56. #define CPG_ISO8859_7           28597
  57. #define CPG_ISO8859_8           28598
  58. #define CPG_ISO8859_9           28599
  59. #define CPG_ISO8859_10          28600
  60. #define CPG_ISO8859_14          28604
  61. #define CPG_ISO8859_15          28605
  62. #define CPG_UTF7                65000
  63. #define CPG_UTF8                65001
  64.  
  65.  
  66.  
  67. /**************************************************/
  68. /* Structures *************************************/
  69. /**************************************************/
  70.  
  71. /*
  72.  *  Type TNEFMIMEINFO
  73.  *
  74.  *  Used by TnefGetInfo, TnefBuildInfo
  75.  */
  76. #include <pshpack1.h>
  77. typedef struct _tnefinfo {
  78.     INETENCODE  wContentEncoding;           /* Content encoding                             */
  79.     BOOL        fAttHdrs;                   /* Tells TnefGetInfo to get att headers only    */
  80.     HANDLE      hHeap;                      /* Heap (from msg) to allocate from             */
  81.     LPWSTR      szTnefCorrelator;           /* TNEF correlator from msg header              */
  82.     WCHAR       szTnefFileName[MAX_PATH];   /* File name of TNEF file, if found             */
  83. } TNEFINFO;
  84. #include <poppack.h>
  85.  
  86. /**************************************************/
  87. /* Functions **************************************/
  88. /**************************************************/
  89.  
  90. /*
  91.  *  TnefGetInfo
  92.  *
  93.  *  Purpose:
  94.  *      Pulls info out of an encoded TNEF file
  95.  *
  96.  *  Parameters:
  97.  *      TNEFINFO *          [in]        describes the TNEF file
  98.  *      MailNonIpmInfo *    [out]       filled in
  99.  *      MailAttArray *      [out]       filled in
  100.  *
  101.  *  Returns:
  102.  *      BOOL        TRUE on success
  103.  *
  104.  *  Side Effects:
  105.  *      * The file identified by ptmi->szTnefFileName is deleted once
  106.  *        processing is completed - error or not
  107.  *      * The remaining parms are filled in
  108.  */
  109. BOOL WINAPI TnefGetInfo(const TNEFINFO *, MailNonIpmInfo **, MailAttArray **);
  110. typedef BOOL (WINAPI * LPFNTNEFGETINFO) (const TNEFINFO *, MailNonIpmInfo **, MailAttArray **);
  111.  
  112. /*
  113.  *  TnefBuildInfo
  114.  *
  115.  *  Purpose:
  116.  *      Puts info into an encoded TNEF file.
  117.  *      Attachments are not supported in this release.
  118.  *
  119.  *  Parameters:
  120.  *      TNEFINFO *          [in]        describes the TNEF file
  121.  *      LPWSTR              [in]        msg subject
  122.  *      MailNonIpmInfo *    [in]        other msg properties
  123.  *      MailAttArray *      [in]        msg attachments
  124.  *
  125.  *  Returns:
  126.  *      BOOL        TRUE indicates success
  127.  *
  128.  *  Side Effects:
  129.  *      szTnefFileName is created on success. Caller is responsible for deleting it.
  130.  *
  131.  */
  132. BOOL WINAPI TnefBuildInfo(const TNEFINFO *, LPWSTR, MailNonIpmInfo *, MailAttArray *);
  133. typedef BOOL (WINAPI * LPFNTNEFBUILDINFO) (const TNEFINFO *, LPWSTR, MailNonIpmInfo *, MailAttArray *);
  134.  
  135. /*
  136.  *  TnefEncodeFile
  137.  *
  138.  *  Purpose:
  139.  *      Encode an attachment for sending
  140.  *
  141.  *  Parameters:
  142.  *      LPWSTR              [in]        attachment filename
  143.  *      INETENCODE          [in]        encoding method
  144.  *
  145.  *  Returns:
  146.  *      LPWSTR  - filename of encoded file
  147.  *
  148.  *  Side Effects:
  149.  *      file is created
  150.  *
  151.  *  Notes:
  152.  *      Input file is not affected.
  153.  *      Returned file must be deleted by caller.
  154.  *      returned name must be LocalFree'd by caller
  155.  */
  156. LPWSTR WINAPI TnefEncodeFile(LPWSTR, INETENCODE);
  157. typedef LPWSTR (WINAPI * LPFNTNEFENCODEFILE) (LPWSTR, INETENCODE);
  158.  
  159. /*
  160.  *  TnefDecodeFile
  161.  *
  162.  *  Purpose:
  163.  *      Decodes a file
  164.  *
  165.  *  Parameters:
  166.  *      INETENCODE          [in]        encoding method
  167.  *      LPWSTR              [in]        name of file to decode
  168.  *      LPWSTR              [in]        name of output file
  169.  *
  170.  *  Returns:
  171.  *      BOOL            TRUE on success
  172.  *
  173.  *  Side Effects:
  174.  *      DecodedFileName is created. Caller is responsible for deleting.
  175.  */
  176. BOOL WINAPI TnefDecodeFile(INETENCODE, LPWSTR, LPWSTR);
  177. typedef BOOL (WINAPI * LPFNTNEFDECODEFILE) (INETENCODE, LPWSTR, LPWSTR);
  178.  
  179. /*
  180.  *  TnefEncodeBuffer
  181.  *
  182.  *  Purpose:
  183.  *      Encode some binary
  184.  *
  185.  *  Parameters:
  186.  *      INETENCODE          [in]        encoding method
  187.  *      UINT                [in]        size of input buffer
  188.  *      BYTE *              [in]        data to encode
  189.  *      UINT *              [in/out]    size of output buffer/encoded data
  190.  *      LPSTR               [in/out]    encoded data
  191.  *
  192.  *  Returns:
  193.  *      BOOL        TRUE on success
  194.  *
  195.  *  Notes:
  196.  *      Output buffer needs to be big enough to contain
  197.  *      all encoded data.
  198.  */
  199. BOOL WINAPI TnefEncodeBuffer(INETENCODE, UINT, BYTE *, UINT *, LPSTR);
  200. typedef BOOL (WINAPI * LPFNTNEFENCODEBUFFER) (INETENCODE, UINT, BYTE *, UINT *, LPSTR);
  201.  
  202. /*
  203.  *  TnefDecodeBuffer
  204.  *
  205.  *  Purpose:
  206.  *      Decode a buffer of ANSI text
  207.  *
  208.  *  Parameters:
  209.  *      INETENCODE          [in]        encoding method
  210.  *      LPSTR               [in]        buffer to decode
  211.  *      BYTE *              [in]        decoded buffer
  212.  *      UINT *              [in/out]    size of output buffer/decoded data
  213.  *
  214.  *  Returns:
  215.  *      BOOL        TRUE on success
  216.  *
  217.  *  Notes:
  218.  *      Output buffer needs to be big enough to contain
  219.  *      all decoded data.
  220.  */
  221. BOOL WINAPI TnefDecodeBuffer(INETENCODE, LPSTR, BYTE *, UINT *);
  222. typedef BOOL (WINAPI * LPFNTNEFDECODEBUFFER) (INETENCODE, LPSTR, BYTE *, UINT *);
  223.  
  224. /*
  225.  *  TnefConvertToUnicode
  226.  *
  227.  *  Purpose:
  228.  *      Convert a string encoded in the specified codepage to Unicode
  229.  *
  230.  *  Parameters:
  231.  *      UINT                [in]        codepage to decode from
  232.  *      DWORD               [in]        character-type options
  233.  *      LPCSTR              [in]        input string
  234.  *      int                 [in]        length of the input string
  235.  *      LPWSTR              [in]        output buffer
  236.  *      int                 [in]        size of the output buffer
  237.  *
  238.  *  Returns:
  239.  *      int        if output buffer size is not 0, number of charactes copied to it;
  240.  *                 otherwise, size of the buffer required to contain the output string;
  241.  *                 0 indicates failure
  242.  *
  243.  *  Notes:
  244.  *    The codepages supported by this routine are:
  245.  *      1250  -- Windows 1250 (Central European langugages)
  246.  *      1251  -- Windows 1251 (Cyrillic)
  247.  *      1252  -- Windows 1252 (Western European languages)
  248.  *      1253  -- Windows 1253 (Greek)
  249.  *      1254  -- Windows 1254 (Turkish)
  250.  *      1255  -- Windows 1255 (Hebrew)
  251.  *      1256  -- Windows 1256 (Arabic)
  252.  *      1257  -- Windows 1257 (Baltic languages)
  253.  *      1258  -- Windows 1258 (Vietnamese)
  254.  *      20866 -- KOI8-R (Russian Cyrillic standard)
  255.  *      21886 -- KOI8-U (Ukrainian Cyrillic standard)
  256.  *      28592 -- ISO 8859-2 (Central European languages)
  257.  *      28593 -- ISO 8859-3 (Esperanto/Galician/Maltese/incomplete Turkish)
  258.  *      28594 -- ISO 8859-4 (Baltic languages)
  259.  *      28595 -- ISO 8859-5 (Cyrillic)
  260.  *      28596 -- ISO 8859-6 (Arabic)
  261.  *      28597 -- ISO 8859-7 (Greek)
  262.  *      28598 -- ISO 8859-8 (Hebrew)
  263.  *      28599 -- ISO 8859-9 (Turkish)
  264.  *      28600 -- ISO 8859-10 (Nordic languages, except Skolt Sami)
  265.  *      28604 -- ISO 8859-14 (Celtic)
  266.  *      28605 -- ISO 8859-15 (Western Europe, updated)
  267.  *      65000 -- UTF-7 (7-bit Unicode encoding)
  268.  *      65001 -- UTF-8 (8-bit Unicode encoding)
  269.  */
  270. int WINAPI TnefConvertToUnicode(UINT, DWORD, LPCSTR, int, LPWSTR, int);
  271. typedef BOOL (WINAPI * LPFNTNEFCONVERTTOUNICODE) (UINT, DWORD, LPCSTR, int, LPWSTR, int);
  272.  
  273. /*
  274.  *  ModifiedUTF7ToUnicode
  275.  *
  276.  *  Purpose:
  277.  *      Converts the IMAP "modified" UTF7 string into straight Unicode.
  278.  *      Includes quoted chars:  \\   \"   &-
  279.  *
  280.  *  Parameters:
  281.  *      LPCSTR              [in]        address of string to convert
  282.  *      int                 [in]        number of bytes in string
  283.  *      LPWSTR              [out]       address of wide-character buffer
  284.  *      int                 [in]        size of output buffer
  285.  *
  286.  *  Returns:
  287.  *      int             character count of Unicode string, including NULL
  288.  *                      terminator.
  289.  */
  290. int WINAPI ModifiedUTF7ToUnicode(LPCSTR lpMultiByteStr, int cchMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
  291. typedef int (WINAPI * LPFNMODIFIEDUTF7TOUNICODE) (LPCSTR, int, LPWSTR, int);
  292.  
  293. /*
  294.  *  UnicodeToModifiedUTF7
  295.  *
  296.  *  Purpose:
  297.  *      Converts the straight Unicode string into IMAP "modified" UTF7.
  298.  *      Quotes chars:  \   "   &
  299.  *
  300.  *  Parameters:
  301.  *      LPCWSTR             [in]        address of string to convert
  302.  *      int                 [in]        number of bytes in string
  303.  *      LPSTR               [out]       address of wide-character buffer
  304.  *      int                 [in]        size of output buffer
  305.  *
  306.  *  Returns:
  307.  *      int             character count of Unicode string, including NULL
  308.  *                      terminator.
  309.  */
  310. int WINAPI UnicodeToModifiedUTF7(LPCWSTR wszIn, int cchIn, LPSTR pchOut, int cchOut);
  311. typedef int (WINAPI * LPFNUNICODETOMODIFIEDUTF7) (LPCWSTR, int, LPSTR, int);
  312.  
  313. #ifdef      __cplusplus
  314. }
  315. #endif      /* __cplusplus */
  316.  
  317. #endif      /* _TNEFAPI_H_ */
  318.